//
//  XiuGaiYongHuMingViewController.m
//  XiangMu
//
//  Created by 康世标 on 15/8/21.
//  Copyright (c) 2015年 康世标. All rights reserved.
//

#import "XiuGaiYongHuMingViewController.h"
#import "GeRenViewController.h"
#import "Header.h"
@interface XiuGaiYongHuMingViewController ()

@end

@implementation XiuGaiYongHuMingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

   self.navigationItem.title = @"修改用户名";
    
    self.quRenBtn.backgroundColor = CL_00cc85;
    self.view.backgroundColor = CL_efeff4 ;
  

    

}
- (IBAction)QueDing:(id)sender{
    
//    self.Myblock(self.textFided.text);
      MBProgressHUD * HUD =[MBProgressHUD showHUDAddedTo:self.view animated:YES];
    if ([self.textFided.text isEqualToString:@""]||self.textFided==nil) {
        
        HUD.mode = MBProgressHUDModeText;
        HUD.labelText = @"请输入新的用户名";
        [HUD hide:YES afterDelay:1];
        
        return;
    }
  
    
  
    [QingQiuShuJu upDate:@(1) Param:self.textFided.text Block:^(NSDictionary *dic, BOOL isOK) {
        
        if (isOK) {
            
            NSUserDefaults * use =[NSUserDefaults standardUserDefaults];
            [use setObject:[[dic valueForKey:@"data"] valueForKey:@"nickname"]forKey:@"nickname"];
            
            HUD.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]];
            
            // Set custom view mode
            HUD.mode = MBProgressHUDModeCustomView;
            
           
            HUD.labelText = @"修改成功";
            
            [HUD show:YES];
            [HUD hide:YES afterDelay:3];

        }
        else{
            
            HUD.labelText = @"请求失败";
            
            [HUD hide:YES afterDelay:2];
            HUD.removeFromSuperViewOnHide = YES;
            
        }
    }];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
